package com.samuel.igoodman.web.book;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.samuel.igoodman.entity.book.BookContent;
import com.samuel.igoodman.web.base.BaseAction;

@SuppressWarnings("serial")
public class BookContentAction extends BaseAction {

	
	private BookContent bookContent;
	
	//录入书籍内容,用于每天分享
	public String write(){
		String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
		setRequestAtt("today", today);
		if("save".equals(op)){
			long id = bookContent.Save();
			bookContent.setId(id);
			return "detail";
		}
		return SUCCESS;
	}
	
	//文章详情
	public String detail(){
		bookContent = bookContent.Get(bookContent.getId());
		return SUCCESS;
	}
	
	public BookContent getBookContent() {
		return bookContent;
	}

	public void setBookContent(BookContent bookContent) {
		this.bookContent = bookContent;
	}
	
}
